﻿/*
Copyright (c) 2011 <a href="http://www.gutgames.com">James Craig</a>

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.*/

#region Usings
using System;
using System.Collections.Generic;
using BlammoNet.Interfaces;
#endregion

namespace DotCache.Interfaces
{
    /// <summary>
    /// Cache interface
    /// </summary>
    public interface ICache : IDisposable, IEnumerable<object>
    {
        #region Functions

        /// <summary>
        /// Gets the specified item from the cache
        /// </summary>
        /// <typeparam name="T">The type of the item</typeparam>
        /// <param name="Key">Key to retrieve</param>
        /// <returns>The item specified</returns>
        T Get<T>(string Key);

        /// <summary>
        /// Clears the cache
        /// </summary>
        void Clear();

        /// <summary>
        /// Removes an item from the cache
        /// </summary>
        /// <param name="Key">The name of the item</param>
        void Remove(string Key);

        /// <summary>
        /// Determines if an item exists
        /// </summary>
        /// <param name="Key">The name of the item</param>
        /// <returns>The item specified</returns>
        bool Exists(string Key);

        /// <summary>
        /// Adds an item to the cache
        /// </summary>
        /// <param name="Key">The name of the item</param>
        /// <param name="Value">The item to add</param>
        void Add(string Key, object Value);

        /// <summary>
        /// Adds an item to the cache
        /// </summary>
        /// <param name="Key">The name of the item</param>
        /// <param name="Value">The item to add</param>
        /// <param name="Expiration">Expiration time</param>
        void Add(string Key, object Value, TimeSpan Expiration);

        #endregion

        #region Properties

        /// <summary>
        /// The number of items in the list
        /// </summary>
        int Count { get; }

        /// <summary>
        /// Used to get/set the specified object
        /// </summary>
        /// <param name="key">The key to the item</param>
        /// <returns>The object specified</returns>
        object this[string Key] { get; set; }

        /// <summary>
        /// Returns a list of keys
        /// </summary>
        ICollection<string> Keys { get; }

        /// <summary>
        /// Log that the cache uses
        /// </summary>
        ILog Log { get; set; }

        /// <summary>
        /// Configuration information
        /// </summary>
        Config.Config Configuration { get; set; }

        #endregion
    }
}
